﻿using System;
using System.Collections.Generic;

namespace Program06
{
    class Program
    {    
        static void Main(string[] args)
        {
            List<int> numList = new List<int>();

            int num = -1;//储存输入值
            int maxNum = -1;//最大值
            int minNum = -1;//最小值

            Console.WriteLine("请输入一个整数(输入0停止)");
            //输入检测
            while (!(int.TryParse(Console.ReadLine(), out num)))
            {
                Console.WriteLine("您输入的不为整数，请重新输入");             
            }
            maxNum = minNum = num;

            //存储最大值最小值
            while (num != 0)
            {
                if (num > maxNum)
                {
                    maxNum = num;
                }
                if (num < minNum) 
                {
                    minNum = num;
                }
                Console.WriteLine("请继续输入");
                while (!(int.TryParse(Console.ReadLine(), out num)))
                {
                    Console.WriteLine("您输入的不为整数,请重新输入");
                }
            }
            Console.WriteLine("最大值:" + maxNum + ",最小值:" + minNum);
            Console.ReadLine();

        }
    }
}
